/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package org.whuims.repository.jpa;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.whuims.entity.Infor;

public interface InforDao extends PagingAndSortingRepository<Infor, Long>, JpaSpecificationExecutor<Infor> {

    Page<Infor> findByAuthorId(Long id, Pageable pageRequest);

    @Modifying
    @Query("delete from Infor infor where infor.author.id=?1")
    void deleteByAuthorId(Long id);
}
